﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebSite.Core;
using Maticsoft.Model.CarrefourCover;
using Shanda.Utility;

namespace WebSite
{
    public partial class index1101: BasePage
    {
        public override bool NeedLogin
        {
            get
            {
                return false;
            }
        }

        public int RowTotal { get; set; }
        public new int PageIndex { get { return WebUtils.GetPostValue(Request, "PageIndex", 0); } }
        public new int PageSize { get { return 4; } }


        public List<RiseBaby> RiseBabyData { get; set; }
        public List<Team> TeamData  = new List<Team>();
        public List<string> listWeiboAwardUserName = new List<string>();

        protected void Page_Load(object sender, EventArgs e)
        {
            // 晋级宝宝数据
            var teambll = new Maticsoft.BLL.CarrefourCover.Team();
            string strWhere = "and status=1 AND ( [TYPE]>=2 )";
            string orderby = "ORDER BY OrderBy DESC,ID DESC"; 
            int totalCount = 0;
            TeamData = teambll.GetListByPage(PageSize, PageIndex + 1, strWhere, orderby, out  totalCount);
            RowTotal = totalCount;

            var tempRiseBabyBll = new Maticsoft.BLL.CarrefourCover.RiseBaby();

            int tempRiseBabyTopNum = 1000;
            string tempRiseBabyWhere = string.Empty;
            //string tempRiseBabyOrder = "OrderId desc,Id desc";
            /*
            var dataSet = tempRiseBabyBll.GetList(tempRiseBabyTopNum, tempRiseBabyWhere, tempRiseBabyOrder);
            if (dataSet != null && dataSet.Tables.Count > 0)
            {
                RiseBabyData = tempRiseBabyBll.DataTableToList(dataSet.Tables[0]);
            }
            */            
            //string tempTriviaWhere = " status=1";
            RiseBabyData = tempRiseBabyBll.GetRandomModelList(tempRiseBabyTopNum, tempRiseBabyWhere);


            Maticsoft.BLL.CarrefourCover.PrizeUserList bll = new Maticsoft.BLL.CarrefourCover.PrizeUserList();
            var listWeiboAward = bll.GetModelList( "Type=1" ).OrderBy( p => p.OrderBy ).ToList();
            foreach (var obj in listWeiboAward)
            {
                listWeiboAwardUserName.AddRange( obj.UserList.Split( ',' ) );
            }
            listWeiboAwardUserName = listWeiboAwardUserName.ToList();
        }

        public string GetImage(Maticsoft.Model.CarrefourCover.Trivia m)
        {
            return m == null ? "" : m.ImageBig;
        }

        public string GetCssClass(Maticsoft.Model.CarrefourCover.Trivia m)
        {
            return m == null ? "a_huaxu_none" : "a_huaxu";
        }

        public string GetTitle(Maticsoft.Model.CarrefourCover.Trivia m)
        {
            return m == null ? "" : m.ImageSmall;
        }
    }
}